<?php
	class Modelway extends ModelBase
	{
		protected $tablename = 'view_way';
		/**
		 * @var CDbConnection
		 */
		function __construct()
		{
			parent::__construct();
		}
		
		//得到途径地列表
		public function getWay($page,$wherearr=0)
		{
			$blimit = $page*PERPAGE;
			$array = array ();
			$array = parent::getTable($this->tablename, $wherearr,$blimit,PERPAGE,' order by way_id desc');
			return $array;
		}
		
		#得到途径地列表
		function getTable($where){
			return parent::getTable($this->tablename, $where);
		}
		
		#搜索途径地
		function searchTable($where){
			return parent::searchTable($this->tablename, $where,0,10);
		}
		
		
		function getOneTable($where){
			return parent::getTable($this->tablename, $where,0,1);
		}
		
		function getRcount($wherearr=0) {
		return parent::getRcount ( $this->tablename,$wherearr );
		}
		#删除途径地
		/* function delTable($where) {
			return parent::deleteTable ( $this->tablename, $where );
		
		} */
	
		function delTable($wherearr){
			$addarr['action'] = 'delete';
			$addarr['update_time']=time();
			return parent::updateTable($this->tablename, $addarr, $wherearr) ;
		}
		
		#添加或修改途径地
		function replaceTable($updatear){
				$updatear['data']['update_time'] = time();
				return parent::replaceTable($this->tablename, $updatear['data']);
		}
		
		function updateTable($addarr,$wherearr){
			$addarr['action'] = 'update';
			$addarr['update_time']=time();
			return parent::updateTable($this->tablename, $addarr, $wherearr) ;
		}
		
	}
?>
